// index.js

Component({
  data: {
    bannerImg: '',
    news: [{
        name: '微博热搜',
        link: 'type=wbHot',
      },
      {
        name: '虎扑步行街',
        link: 'type=huPu',
      },
      {
        name: '知乎热榜',
        link: 'type=zhihuHot',
      },
      {
        name: '哔哩哔哩',
        link: 'type=bili',
      },
      {
        name: '百度热点',
        link: 'type=baiduRD',
      },
      {
        name: '微信财经',
        link: 'type=wxMoney',
      },
      {
        name: '微信搞笑',
        link: 'type=wxJoke',
      },
      {
        name: '抖音热点',
        link: 'type=douyinHot',
      }
    ],
  },
  created() {
    wx.redirectTo({
      url: '../index/index.js',
    })
    this.getBanner();
  },
  methods: {
    getBanner() {
      wx.request({
        url: 'https://api.vvhan.com/api/view?type=json',
        dataType: 'json',
        success: (res) => {
          this.bannerImg = res.data.imgurl;
          this.setData({
            bannerImg: res.data.imgurl
          })
          console.log(this.bannerImg)
        }
      })
    },
    imgloding() {
      wx.hideLoading();
    }
  },
})